home *** CD-ROM | disk | FTP | other *** search
- Subject: v13i099: Multi-user conferencing system, Part02/05
- Newsgroups: comp.sources.unix
- Sender: sources
- Approved: rsalz@uunet.UU.NET
-
- Submitted-by: Keith Gabryelski <ag@crash.cts.com>
- Posting-number: Volume 13, Issue 99
- Archive-name: conf/part02
-
- #! /bin/sh
- # This is a shell archive, meaning:
- # 1. Remove everything above the #! /bin/sh line.
- # 2. Save the resulting text in a file.
- # 3. Execute the file with /bin/sh (not csh) to create the files:
- # conf.h
- # confalloc.c
- # config.h
- # confopts.c
- export PATH; PATH=/bin:$PATH
- if test -f 'conf.h'
- then
- echo shar: will not over-write existing file "'conf.h'"
- else
- cat << \SHAR_EOF > 'conf.h'
- /*
- * conf - An interactive multi-user chat program.
- *
- * conf Copyright (c) 1986, 1987 by Keith Gabryelski
- *
- * Conf is quasi-public domain software; it may be used and copied
- * freely and may be modified to suit the indivuals needs as long
- * as:
- *
- * [1] It is not sold.
- * [2] It is not made part of any licensed product.
- * [3] This header and others like it are not modified or removed.
- * [4] You allow others to use and copy without charge.
- *
- * without expressed written permission from the original
- * author (Keith Gabryelski).
- *
- */
-
- #include "config.h"
- #include <stdio.h>
- #include <sys/types.h>
- #include <ctype.h>
- #include <signal.h>
- #include <sys/stat.h>
- #include <pwd.h>
- #include <setjmp.h>
- #include <errno.h>
-
- #ifdef SYSV
- #include <unistd.h>
- #include <termio.h>
- #include <fcntl.h>
- #endif SYSV
-
- #ifdef BSD
- #include <sgtty.h>
- #include <sys/ioctl.h>
- #include <sys/file.h>
-
- #define index strchr
- #define rindex strrchr
- #endif BSD
-
-
- #include "structs.h"
- #include "extern.h"
-
- /*
- * some ASCII values
- *
- */
-
- #ifdef CTRL
- #undef CTRL
- #endif CTRL
- #define CTRL(c) ('c'&0x1F)
- #define BELL 0x07
- #define BS 0x08
- #define TAB 0x09
- #define LF 0x0A
- #define CR 0x0D
- #define DEL 0x7F
-
- /*
- * some bools
- *
- */
-
- #ifdef TRUE
- #undef TRUE
- #endif TRUE
- #define TRUE 1
-
- #ifdef FALSE
- #undef FALSE
- #endif FALSE
- #define FALSE 0
-
- #define NEXTWORD 1
- #define THEREST 2
-
- #define NOVIS 0
- #define VIS 1
-
- #define forever for ever
- #define ever (;;)
- SHAR_EOF
- fi # end of overwriting check
- if test -f 'confalloc.c'
- then
- echo shar: will not over-write existing file "'confalloc.c'"
- else
- cat << \SHAR_EOF > 'confalloc.c'
- /*
- * conf - An interactive multi-user chat program.
- *
- * conf Copyright (c) 1986, 1987 by Keith Gabryelski
- *
- * Conf is quasi-public domain software; it may be used and copied
- * freely and may be modified to suit the indivuals needs as long
- * as:
- *
- * [1] It is not sold.
- * [2] It is not made part of any licensed product.
- * [3] This header and others like it are not modified or removed.
- * [4] You allow others to use and copy without charge.
- *
- * without expressed written permission from the original
- * author (Keith Gabryelski).
- *
- */
-
- #include "conf.h"
-
- /*
- * memory managment stuff.
- */
-
- char *
- mymalloc(size)
- unsigned size;
- {
- char *p;
-
- if ((p = malloc(size)) == NULL)
- {
- (void)fprintf(stderr, "%s: Out of memory.\n", progname);
- nice_exit(-1);
- }
-
- return p;
- }
-
- char *
- myrealloc(p, size)
- char *p;
- unsigned size;
- {
- if (p == NULL)
- {
- if ((p = malloc(size)) == NULL)
- {
- (void)fprintf(stderr, "%s: Out of memory.\n", progname);
- nice_exit(-1);
- }
- }
- else if ((p = realloc(p, size)) == NULL)
- {
- (void)fprintf(stderr, "%s: Out of memory.\n", progname);
- nice_exit(-1);
- }
-
- return p;
- }
- SHAR_EOF
- fi # end of overwriting check
- if test -f 'config.h'
- then
- echo shar: will not over-write existing file "'config.h'"
- else
- cat << \SHAR_EOF > 'config.h'
- /*
- * conf - An interactive multi-user chat program.
- *
- * conf Copyright (c) 1986, 1987 by Keith Gabryelski
- *
- * Conf is quasi-public domain software; it may be used and copied
- * freely and may be modified to suit the indivuals needs as long
- * as:
- *
- * [1] It is not sold.
- * [2] It is not made part of any licensed product.
- * [3] This header and others like it are not modified or removed.
- * [4] You allow others to use and copy without charge.
- *
- * without expressed written permission from the original
- * author (Keith Gabryelski).
- *
- */
-
- /*
- * System type. Define only the *ONE* system that applies to you
- * the most.
- */
-
- #define SYSV /* System V and Xenix. SCO Xenix */
- /*#define BSD /* Any of the Berkeley clan */
-
- /*
- * Define MYCRYPT only if you do not have working encrypt() or setkey()
- * system calls. Some system do not come with crypt because of oversea's
- * laws.
- *
- * Some systems have a broken encrypt() system call (3b1, and SCO Xenix)
- *
- * The crypt functions supplied by me are BOGUS. If you have a public
- * domain crypt that I may include with later releases, please email a
- * copy to: ag@portnoy.cts.com or crash!portnoy!ag@nosc.mil
- *
- * If you *DO NOT* define MYCRYPT and conference messages look somewhat
- * like line noise, then your encrypt function will not work with conf.
- * You must then, define MYCRYPT and re-make conf.
- *
- */
-
- #define MYCRYPT /* Use my crypt function? */
-
- /*
- * Define USE_TERMCAP if you have the termcap library. conf will work
- * without termcap. I include it to figure out the users terminal clear
- * screen string. The clear screen string can be defined in your CONFOPTS
- * environment variable, .confrc, or at any time during conf.
- *
- * If you define this variable remember to include "-lcurses", "-ltermcap",
- * or "-ltermlib" in the Makefile.
- *
- */
-
- #define USE_TERMCAP /* Use-p TERMCAP */
-
- /*
- * Define SENDER as the local command to use to SEND a message.
- * :rings will popen() this command giving it one user on the
- * command line and its message through standard input.
- *
- * If you do not have a local SEND program then define this as
- * "write".
- */
-
- #define SENDER "write" /* the local send program */
-
- /*
- * The default pager
- * maybe "more" or "cat"
- */
-
- #define DEF_PAGER "less" /* local pager */
- #define DEF_SHELL "csh" /* default shell*/
-
- /*
- * User settable files.
- * Someday these files will be definable at any time during conf
- */
-
- #define CONFLOG "/usr/lib/conf/conflog" /* conversation log */
- #define CONFUSERS "/usr/lib/conf/confusers" /* user log */
- #define CONFHELP "/usr/lib/conf/confhelp" /* help file */
-
- #define DEF_RECFILE "conf.rec" /* default record file */
- #define CONFRC ".confrc" /* default rc file */
-
- #define CONFOPTS "CONFOPTS" /* evironment variable */
-
- #define NUMBER_OF_THE_BEAST 0666
- #define FILEMASK NUMBER_OF_THE_BEAST /* filemask for CONF{USERS,LOG} */
-
- /* Some buffer length stuff */
- #define MAXNAMELEN 21
- #define MAXTTYLEN 21
- #define MAXCONFLINES 100 /* number of conference lines */
-
- #define PAGESIZ 512 /* alloc this amount at a time */
-
- /*
- * DEF_CLSSTR is a default clear screen string. It will be used if
- * conf cannot figure out your terminal (using TERMCAP) and the user
- * does set the clear screen string to something different.
- *
- * It is currently set to the ANSI clear screen string. You may
- * want to set it to "\n" for no action.
- *
- */
-
- #define DEF_CLS "\033[2J\033[H" /* default clear screen screen */
- #define DEF_COLUMNS 80
- #define DEF_LINES 24
- #define TABAGE 2 /* space between columns */
-
- /*
- * The public key is used for normal messages, sends, replies, and informs
- * if another password is not given.
- *
- * Passwords are 8 characters or less.
- */
-
- #define MAXPASSWORDLEN 8
- #define DEF_KEY "Pax" /* default public key */
-
- /*
- * Some important influences.
- *
- * Thanks should also go out to Neil Pert for awesome percussion. -MQH
- */
-
- #define SIGNIFICANT_OTHER "Marla Gabryelski"
-
- #define MUSICIAN "Brian_Eno"
- #define SONG "Third_Uncle"
-
- #define VERNUM 1
- #define PATCHLEVEL 0
-
- #define AUTHOR "Keith M. Gabryelski"
- #define ADDRESS "ag@portnoy.cts.com"
- #define ALTPATH "ag@crash.cts.com"
- #define THANKS1 "ford@kenobi.cts.com (Mike Ditto)"
- #define THANKS2 "paul@portnoy.cts.com (Paul Palacios)"
-
- /*
- * form strings
- *
- * Meta characters for form string:
- *
- * %N - Your conference name.
- * %n - Name of user sending message.
- * %m - Message users sent.
- * %T - Your tty.
- * %t - Tty of user that sent message.
- * %% - The character '%'
- *
- */
-
- #define DEF_FORM_NORM ";;; %n (%t) - %m\n"
- #define DEF_FORM_SEND ">>> %n (%t) - %m\n"
- #define DEF_FORM_INFORM "::: %n (%t) [%m]\n"
- #define DEF_FORM_LINE "::: %n (%t) - %m\n"
- #define DEF_FORM_SHOUT "*** %n (%t) - %m\n"
-
- /*
- * DEBUGx are debugging defines.
- *
- */
-
- #define DEBUG0 /* insignificant checks around conf */
- /*#define DEBUG1 /* temporary debug messages */
- /*#define DEBUG2 /* dealing with crypt and block functions */
- /*#define DEBUG3 /* another temporary */
- SHAR_EOF
- fi # end of overwriting check
- if test -f 'confopts.c'
- then
- echo shar: will not over-write existing file "'confopts.c'"
- else
- cat << \SHAR_EOF > 'confopts.c'
- /*
- * conf - An interactive multi-user chat program.
- *
- * conf Copyright (c) 1986, 1987 by Keith Gabryelski
- *
- * Conf is quasi-public domain software; it may be used and copied
- * freely and may be modified to suit the indivuals needs as long
- * as:
- *
- * [1] It is not sold.
- * [2] It is not made part of any licensed product.
- * [3] This header and others like it are not modified or removed.
- * [4] You allow others to use and copy without charge.
- *
- * without expressed written permission from the original
- * author (Keith Gabryelski).
- *
- */
-
- #include "conf.h"
-
- int set_name(), set_integer(), set_ptrstr();
-
- #ifdef USE_TERMCAP
- char *ocls;
- int use_ocap, ocol, olin;
- #endif USE_TERMCAP
-
- gettcap()
- {
- char *ptr;
-
- #ifdef USE_TERMCAP
- char buf[1024];
-
- use_ocap = FALSE;
- if (tgetent(buf, getenv("TERM")) == 1)
- {
- columns=tgetnum("co");
- lines=tgetnum("li");
- tcapstr("cl", &cls);
- use_ocap= TRUE;
- ocol = columns;
- olin = lines;
- ocls = mymalloc(strlen(cls)+1);
- (void) strcpy(ocls, cls);
- }
- #endif USE_TERMCAP
-
- if ((ptr = getenv("COLUMNS")) != NULL)
- columns = atoi(ptr);
-
- if ((ptr = getenv("LINES")) != NULL)
- lines = atoi(ptr);
-
- if ((ptr = getenv("CLS")) != NULL)
- {
- cls = myrealloc(cls, strlen(ptr)+1);
- (void) strcpy(cls, ptr);
- }
-
- if ((ptr = getenv("SHELL")) != NULL)
- {
- shell = myrealloc(shell, strlen(ptr)+1);
- (void) strcpy(shell, ptr);
- }
-
- if ((ptr = getenv("PG")) != NULL)
- {
- pager = myrealloc(pager, strlen(ptr)+1);
- (void) strcpy(pager, ptr);
- }
- }
-
- getrc()
- {
- char *fname;
- char tmp[100];
- char *bp, *p;
- int c;
- FILE *fp;
-
- if (homedir == NULL)
- {
- (void)fprintf(stderr, "%s: Can't figure you out! Not using %s.\n",
- progname, CONFRC);
- return;
- }
-
- fname = mymalloc((unsigned)(strlen(homedir) + 1 + strlen(CONFRC) + 1));
-
- (void)strcpy(fname, homedir);
- (void)strcat(fname, "/");
- (void)strcat(fname, CONFRC);
-
- if ((fp = fopen(fname, "r")) == (FILE *)NULL)
- {
- if (errno != ENOENT)
- (void)fprintf(stderr, "%s: Couldn't open confrc file %s (%s).\n",
- progname, fname, puterr(errno));
-
- free(fname);
- return;
- }
-
- forever
- {
- p = bp = tmp;
-
- while (((c = getc(fp)) != EOF) && (c != '\n'))
- *p++ = c;
-
- if (c == EOF)
- break;
-
- *p = '\0';
-
- while (isspace(*bp))
- bp++;
-
- if ((*bp == '#') || (*bp == ';') || (*bp == '\0'))
- continue;
-
- if (*bp == ':') /* a colon command? */
- {
- linelen = strlen(bp+1);
- if (!intpret(bp+1))
- {
- (void) printf("Invalid confrc line in %s @\"%s\".\n",fname,bp);
- return;
- }
- }
- else
- {
- if ((bp = parsestr(bp, p-bp, NEXTWORD)) == NULL)
- continue;
-
- do
- {
- if ((c = setopts(bp)) != FOUNDOPT)
- {
- if (c == AMBIGUOUS)
- (void)fputs("Ambiguous", stdout);
- else
- (void)fputs("Invalid", stdout);
-
- (void)printf(" confrc file %s @\"%s\"\n", fname, bp);
- free(fname);
- return;
- }
- } while ((bp = parsestr((char *)NULL, 0, NEXTWORD)) != NULL);
- }
- }
-
- free(fname);
-
- (void)fclose(fp);
- }
-
- getopts()
- {
- char *ptr;
- int x;
-
- #ifdef USE_TERMCAP
- if (use_ocap)
- {
- columns= ocol;
- lines=olin;
- cls = myrealloc(cls, strlen(ocls)+1);
- (void) strcpy(cls, ocls);
- free(ocls);
- }
- #endif USE_TERMCAP
-
- if ((ptr = getenv("COLUMNS")) != NULL)
- columns = atoi(ptr);
-
- if ((ptr = getenv("LINES")) != NULL)
- lines = atoi(ptr);
-
- if ((ptr = getenv("CLS")) != NULL)
- {
- cls = myrealloc(cls, strlen(ptr)+1);
- (void) strcpy(cls, ptr);
- }
-
- if ((ptr = getenv("SHELL")) != NULL)
- {
- shell = myrealloc(shell, strlen(ptr)+1);
- (void) strcpy(shell, ptr);
- }
-
- if ((ptr = getenv("PAGER")) != NULL)
- {
- pager = myrealloc(pager, strlen(ptr)+1);
- (void) strcpy(pager, ptr);
- }
-
- if ((ptr = getenv(CONFOPTS)) != NULL)
- {
- ptr = parsestr(ptr, strlen(ptr), NEXTWORD);
-
- do
- {
- if ((x = setopts(ptr)) != FOUNDOPT)
- {
- if (x == AMBIGUOUS)
- (void)fputs("Ambiuous", stdout);
- else
- (void)fputs("Invalid", stdout);
-
- (void)printf(" %s environment variable @%s\n", CONFOPTS, ptr);
- break;
- }
- } while ((ptr = parsestr((char *)NULL, 0, NEXTWORD)) != NULL);
- }
- }
-
- setopts(opt)
- char *opt;
- {
- int found;
-
- static struct varopts vartab[] =
- {
- { "askdump", BOOLEAN|DISPLAY, &askdump, TRUE, },
- { "noaskdump", BOOLEAN|DISPLAY, &askdump, FALSE, },
- { "!askdump", BOOLEAN|NODISPLAY, &askdump, FALSE, },
- { "autowho", BOOLEAN|DISPLAY, &autowho, TRUE, },
- { "noautowho", BOOLEAN|DISPLAY, &autowho, FALSE, },
- { "!autowho", BOOLEAN|NODISPLAY, &autowho, FALSE, },
- { "banner", BOOLEAN|DISPLAY, &banner, TRUE, },
- { "nobanner", BOOLEAN|DISPLAY, &banner, FALSE, },
- { "!banner", BOOLEAN|NODISPLAY, &banner, FALSE, },
- { "beep", BOOLEAN|DISPLAY, &beep, TRUE, },
- { "nobeep", BOOLEAN|DISPLAY, &beep, FALSE, },
- { "!beep", BOOLEAN|NODISPLAY, &beep, FALSE, },
- { "columns", NUMBER|DISPLAY, &columns, 0, set_integer, },
- { "cls", STRING|DISPLAY, (int *)&cls, POINTER, set_ptrstr, },
- { "expand8bit", BOOLEAN|DISPLAY, &expand8bit, TRUE, },
- { "noexpand8bit", BOOLEAN|DISPLAY, &expand8bit, FALSE, },
- { "!expand8bit", BOOLEAN|NODISPLAY, &expand8bit, FALSE, },
- { "expandctrl", BOOLEAN|DISPLAY, &expandctrl, TRUE, },
- { "noexpandctrl", BOOLEAN|DISPLAY, &expandctrl, FALSE, },
- { "!expandctrl", BOOLEAN|NODISPLAY, &expandctrl, FALSE, },
- { "inform-format", STRING|DISPLAY, (int *)&informform, POINTER, set_ptrstr, },
- { "line", NUMBER|DISPLAY, &cuser.cu_line, 0, do_to, },
- { "line-format", STRING|DISPLAY, (int *)&lineform, POINTER, set_ptrstr, },
- { "lines", NUMBER|DISPLAY, &lines, 0, set_integer, },
- { "lineinput", BOOLEAN|DISPLAY, &lineinput, TRUE, },
- { "nolineinput", BOOLEAN|DISPLAY, &lineinput, FALSE, },
- { "nolineinput", BOOLEAN|DISPLAY, &lineinput, FALSE, },
- { "!lineinput", BOOLEAN|NODISPLAY, &lineinput, FALSE, },
- { "name", STRING|DISPLAY, (int *)cuser.cu_cname, ROUTINE, set_name, },
- { "normal-format", STRING|DISPLAY, (int *)&normform, POINTER, set_ptrstr, },
- { "pager", STRING|DISPLAY, (int *)&pager, POINTER, set_ptrstr, },
- { "password", STRING|NODISPLAY, (int *)curpass, ROUTINE, set_pass, },
- { "recfile", STRING|DISPLAY, (int *)&recfile, POINTER, set_ptrstr, },
- { "seeme", BOOLEAN|DISPLAY, &seeme, TRUE, },
- { "noseeme", BOOLEAN|DISPLAY, &seeme, FALSE, },
- { "!seeme", BOOLEAN|NODISPLAY, &seeme, FALSE, },
- { "seemyinform", BOOLEAN|DISPLAY, &informe, TRUE, },
- { "noseemyinform", BOOLEAN|DISPLAY, &informe, FALSE, },
- { "!seemyinform", BOOLEAN|NODISPLAY, &informe, FALSE, },
- { "send-format", STRING|DISPLAY, (int *)&sendform, POINTER, set_ptrstr, },
- { "shell", STRING|DISPLAY, (int *)&shell, POINTER, set_ptrstr, },
- { "shout-format", STRING|DISPLAY, (int *)&shoutform, POINTER, set_ptrstr, },
- { "warncrypt", BOOLEAN|DISPLAY, &warncrypt, TRUE, },
- { "nowarncrypt", BOOLEAN|DISPLAY, &warncrypt, FALSE, },
- { "!warncrypt", BOOLEAN|NODISPLAY, &warncrypt, FALSE, },
- { NULL, }
- }, *varptr, *keepptr;
-
- if (opt == NULL)
- {
- char *string;
- int tmp;
- int len=0;
-
- for (varptr = vartab; varptr->name != NULL; varptr++)
- if ((varptr->type == BOOLEAN) && (*varptr->var == varptr->extra))
- if ((tmp = strlen(varptr->name)) > len)
- len = tmp;
-
- len += TABAGE;
-
- (void)fputs("Boolean flags:\n\n", stdout);
-
- for (varptr = vartab; varptr->name != NULL; varptr++)
- if ((varptr->type == BOOLEAN) && (*varptr->var == varptr->extra))
- colprnt(varptr->name, len);
-
- terpri();
-
- len = 0;
-
- for (varptr = vartab; varptr->name != NULL; varptr++)
- if (varptr->type == NUMBER)
- if ((tmp = strlen(varptr->name)+1+declen(varptr->var)) > len)
- len = tmp;
-
- len += TABAGE;
-
- (void)fputs("\nNumeric options:\n\n", stdout);
-
- string = mymalloc((unsigned)(len+1));
- for (varptr = vartab; varptr->name != NULL; varptr++)
- if (varptr->type == NUMBER)
- {
- (void) sprintf(string, "%s=%d", varptr->name, *varptr->var);
- colprnt(string, len);
- }
-
- terpri();
-
- len = 0;
-
- for (varptr = vartab; varptr->name != NULL; varptr++)
- if (varptr->type == STRING)
- if (varptr->extra&POINTER)
- {
- if ((tmp=strlen(varptr->name)+vislen(*varptr->var)+3) > len)
- len = tmp;
- }
- else
- {
- if ((tmp= strlen(varptr->name)+vislen(varptr->var)+3) > len)
- len = tmp;
- }
-
- len += TABAGE;
-
- (void)fputs("\nString options:\n\n", stdout);
-
- string = myrealloc(string, (unsigned)(len+1));
- for (varptr = vartab; varptr->name != NULL; varptr++)
- if (varptr->type == STRING)
- {
- if (varptr->extra&POINTER)
- (void) sprintf(string, "%s=\"%s\"", varptr->name,
- *varptr->var);
- else
- (void) sprintf(string, "%s=\"%s\"", varptr->name,
- varptr->var);
- colprnt(string, len);
- }
-
- terpri();
- free(string);
-
- return FOUNDOPT;
- }
-
- keepptr = (struct varopts *)NULL;
- found = 0;
- for (varptr = vartab; varptr->name != NULL; varptr++)
- if (!strncmp(varptr->name, opt, strlen(opt)))
- {
- if (!found)
- keepptr = varptr;
-
- if (found >= 0)
- ++found;
-
- if (strlen(varptr->name) == strlen(opt))
- {
- found = -1;
- keepptr = varptr;
- }
- }
-
- if (!found)
- return NOOPT;
-
- if (found > 1)
- return AMBIGUOUS;
-
- switch(keepptr->type&VARMASK)
- {
- case BOOLEAN:
- *keepptr->var = keepptr->extra;
- break;
-
- case NUMBER:
- return (*keepptr->var_func)(keepptr->name, keepptr->var);
-
- case STRING:
- return (*keepptr->var_func)(keepptr->name, keepptr->var);
-
- default:
- return NOOPT;
- }
-
- return FOUNDOPT;
- }
-
- set_name()
- {
- char *ptr, *ptr2;
- char nbuf[20+MAXNAMELEN];
-
- if ((ptr = ptr2 = parsestr((char *)NULL, 0, NEXTWORD)) == NULL)
- {
- if (confing)
- {
- (void) printf("name = \"%s\"\n", cuser.cu_cname);
- return TRUE;
- }
-
- return FALSE;
- }
-
- while(*ptr2 != '\0')
- {
- if ((*ptr2 > ' ') && !strchr(",:/", *ptr2))
- ptr2++;
- else
- *ptr2 = '\0';
- }
-
- if (*ptr == '\0')
- {
- if (confing)
- {
- (void)puts("Invalid name given.");
- return TRUE;
- }
-
- return FALSE;
- }
-
- (void) sprintf(nbuf, "Changed name from %s", cuser.cu_cname);
-
- (void) strncpy(cuser.cu_cname, ptr, MAXNAMELEN);
- cuser.cu_cname[MAXNAMELEN-1] = '\0';
- clog.f_usrlen = strlen(cuser.cu_cname) + 1;
-
- if (confing)
- {
- write_log(INFORM, nbuf, (char *)NULL, 0, (unsigned)strlen(nbuf));
- write_usr();
- (void)printf("Name changed to \"%s\"\n", cuser.cu_cname);
- }
-
- return TRUE;
- }
-
- set_integer(name, var)
- char *name;
- int *var;
- {
- char *ptr;
-
- if ((ptr = parsestr((char *)NULL, 0, NEXTWORD)) != NULL)
- *var = atoi(ptr);
-
- (void) printf("%s = %d\n", name, *var);
- return FOUNDOPT;
- }
-
- set_ptrstr(name, var)
- char *name, **var;
- {
- char *ptr;
-
- if ((ptr = parsestr((char *)NULL, 0, NEXTWORD)) != NULL)
- {
- *var = myrealloc(*var, strlen(ptr)+1);
- (void) strcpy(*var, ptr);
- }
-
- (void) printf("%s = \"", name);
- visprnt(*var, stdout);
- (void) puts("\"");
-
- return FOUNDOPT;
- }
-
- declen(num)
- register int num;
- {
- register int places = 1;
-
- while ((num /= 10) >= 1)
- ++places;
-
- return places;
- }
-
- tcapstr(string, var)
- char *string, **var;
- {
- char *tcapbuf = mymalloc(1024);
- char *tmp = tcapbuf;
-
- (void) tgetstr(string, &tmp);
- *var = realloc(*var, tmp-tcapbuf);
- (void) strcpy(*var, tcapbuf);
- free(tcapbuf);
- }
- SHAR_EOF
- fi # end of overwriting check
- # End of shell archive
- exit 0
-
-